import GENE_LOADING from '@/assets/image/generate_loading.gif';
import { useEffect, useState } from 'react';
import styles from './index.less';

const Loading: React.FC<any> = () => {
  const [tips, setTips] = useState<string>('AI智能生成中,请稍等');
  // Ai正在批量生成文章、Ai正在筛选文章、Ai正在返回文章
  useEffect(() => {
    const tipsArr = ['Ai正在批量生成文章', 'Ai正在筛选文章', 'Ai正在返回文章'];
    let index = 0;
    let interval = setInterval(() => {
      setTips(tipsArr[index]);
      index++;
      if (index > 3) {
        index = 0;
        clearInterval(interval);
        setTips(tipsArr[2]);
      }
    }, 15000);
  }, []);
  return (
    <div className={styles.loading}>
      <img src={GENE_LOADING} alt="" height={33} width={55} style={{ marginRight: 4 }} />
      {tips}......
    </div>
  );
};

export default Loading;
